-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CodeBlock,ProgramAst: implement Serialize/Deserialize #1173
CodeBlock,ProgramAst: implement Serialize/Deserialize #1173
Conversation
b7167e5
to
eccf896
Compare
8f1f058
to
cb1bb9e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Looks good! I left a couple of small comments inline - but there is a bigger question about the general approach.
Specifically, we used to have these implementations but we removed them some time ago because we needed to specify serialization options for ProgramAst
and ModuleAst
, and unfortunately, Winterfell serialization traits do not provide a way to specify such options.
So, we have a couple of things to consider:
- If we want to provide
Serializable
andDeserializable
implementations, what serialization options should we use as the default? (one approach is to serialize everything, which is what the current implementation is doing). - Another option could be to add
write_into()
andread_from()
methods to the struct. These methods would have similar signatures to what is in the traits, but would also take an additionalAstSerdeOptions
as a parameter.
a. With this approach we may also be able get rid ofwrite_source_locations
andload_source_locations
methods as these could be just another option inAstSerdeOptions
. - We could also combine the above approaches - e.g., implement concrete methods and then call them from trait implementations passing default
AstSerdeOptions
as parameters. - Lastly, we could try to modify Winterfell to add an associated type for serialization/deserialization options - but without default associated types this would be a breaking change, and may not be worth it for now.
cb1bb9e
to
381329c
Compare
I've removed We should probably do a more comprehensive refactoring of serialization/deserialization of AST structs - but that's for a different PR. |
Describe your changes
review/merge after #1172
adds serializer/deserializer to CodeBlock and ProgramAst.
Checklist before requesting a review
next
according to naming convention.